// 1. defer：推迟执行
const defer = (fn, ...args) => setTimeout(fn, 1, ...args);

defer(console.log, 'a'), console.log('b'); // logs 'b' then 'a'

// 2. once：只调用一次的函数
const once = (fn) => {
	let called = false;
	return function() {
		if (!called) {
			called = true;
			fn.apply(this, arguments);
		}
	};
};
